package cn.tedu.apps_system.pojo.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.*;
import java.util.List;

@Data
public class OrderCreateRequestDto {
    @NotNull(message = "用户ID不能为空")
    private Long userId;

    @NotNull(message = "商家ID不能为空")
    private Long merchantId;

    @NotBlank(message = "收货地址不能为空")
    private String shippingAddress;

    @NotBlank(message = "联系电话不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式错误") // 手机号格式校验
    private String contactPhone;

    @NotBlank(message = "联系人不能为空")
    private String contactName;

    private String remark; // 可选字段

    @NotEmpty(message = "商品列表不能为空")
    private List<OrderItemRequestDto> items; // 订单商品明细

    @Min(value = 0, message = "运费不能为负数")
    private Integer freight = 0; // 默认运费0

    @ApiModelProperty(value = "支付方式", required = true)
    private Integer paymentType;
}
